<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Table extends Model
{
    use HasFactory;

    public $guarded = [];

    static function db_tables($dbId) {
        return self::where('db_id', $dbId)->get();
    }

    static function columns($tableId) {
        return Column::where('table_id', $tableId)->orderBy('sort')->get();
    }
}
